<template>
  <div>
    <el-breadcrumb separator-class='el-icon-arrow-right'>
      <el-breadcrumb-item v-bind:to='{ path: "/" }'>首页</el-breadcrumb-item>
      <el-breadcrumb-item>人才招聘</el-breadcrumb-item>
      <el-breadcrumb-item>查看招聘信息</el-breadcrumb-item>
    </el-breadcrumb>
    <div class='dict-main'>
      <el-tabs v-model='activeName' class='title-top'>
        <el-tab-pane label='查看招聘详情' name='first'>
          <div class='main-module charger'>
            <el-row class='posre'>
              <el-col :span='12' class='text-right search-top'>
                <el-button size='small' type="primary" icon="el-icon-edit"  @click='recruitEdit()'> 修改
                </el-button>
                <el-button size='small' type='warning' icon='el-icon-back' @click='backToList()'>返回</el-button>
              </el-col>
            </el-row>
            <div>
              <el-row :gutter="20">
                <el-col :span="14" :offset="2">
                  <el-form :model="addForm" :rules="rules" ref="addForm" label-width="100px" label-suffix=":">
                    <el-form-item label="岗位名称" prop="jobName">
                      <span style="margin-left: 30px;">{{addForm.jobName}}</span>
                    </el-form-item>
                    <el-form-item label="岗位类别" prop="jobType">
                      <span style="margin-left: 30px;" v-if="addForm.jobType==1">技术大牛</span>
                      <span style="margin-left: 30px;" v-if="addForm.jobType==2">管理人才</span>
                      <span style="margin-left: 30px;" v-if="addForm.jobType==3">销售精英</span>
                    </el-form-item>
                    <el-form-item label="招聘人数" prop="hireNum">
                      <span style="margin-left: 30px;">{{addForm.hireNum}}人</span>
                    </el-form-item>
                    <el-form-item label='工作地点'  class='widthrow'>
                        <span style="margin-left: 30px;">{{addForm.showWorkplace}}</span>
                    </el-form-item>
                    <el-form-item label="生效日期" prop="startTime">
                      <span style="margin-left: 30px;">{{addForm.startTime}}</span>
                    </el-form-item>
                    <el-form-item label="岗位标签" prop="label">
                      <el-tag style="margin-left: 30px;"
                        :key="tag"
                        type="warning"
                        v-for="tag in dynamicTags"
                        :disable-transitions="false">
                        {{tag}}
                      </el-tag>
                    </el-form-item>
                    <el-form-item label="招聘说明" prop="content" style="margin-bottom: 100px;width: 150%;">
                      <el-card class="box-card">
                      <dl v-html="addForm.content">
                        {{addForm.content}}
                      </dl>
                    </el-card>
                    </el-form-item>

                  </el-form>
                </el-col>
              </el-row>
            </div>
          </div>
        </el-tab-pane>
      </el-tabs>
    </div>


  </div>
</template>

<script>
  import {
    loadRecruitDetail
  } from '@/api/recruit';
  export default {
    data() {
      return {
        activeName: 'first',
        inputVisible: false,
        addBtVisible: true,
        inputValue: '',
        editorOption: {
          modules: {
            toolbar: [
            ]
          }
        },
        dynamicTags: [],
        provinces: [],
        cities: [],
        addForm: {
          jobName: '',
          jobType: '1',
          workplace: '',
          hireNum: 1,
          label: '',
          startTime: '',
          content: ''
        }
      };
    },
    filters: {},
    methods: {
      backToList() {
        this.$router.push({
          path: '/team/recruit'
        })
      },
      loadRecruitDetail () {
        loadRecruitDetail(this.$route.params.recruitId).then(response => {
          if (response.code !== 0) {
            this.$message({
              message: response.message,
              type: 'error'
            });
          } else {
            this.addForm = response.data;
            this.dynamicTags= response.data.label.split(',');
            this.findCitys(response.data.provinceCode);
          }
        });
      },
      recruitEdit(){
        var recruitId=this.addForm.id;
        this.$router.push({
          path: `/team/recruit/edit/${recruitId}`
        })
      }
    },
    watch: {
    },
    created: function () {
      this.loadRecruitDetail();
    }
  };
</script>

<style>
  .el-tag + .el-tag {
    margin-left: 10px;
  }

  .button-new-tag {
    margin-left: 10px;
    height: 32px;
    line-height: 30px;
    padding-top: 0;
    padding-bottom: 0;
  }

  .input-new-tag {
    width: 90px;
    margin-left: 10px;
    vertical-align: bottom;
  }
</style>
